require 'skpreader'

application = SUSDK::SkpApplication::getApplication()
puts "Application name = #{application.name}"

fileReader = application.fileReader()
textureWriter=application.createTextureWriter()
p textureWriter.inspect
document = fileReader.openFile("C:\\box.skp")
entityProvider = document.entityProvider
faces = entityProvider.faces()
puts faces.inspect
face = faces.item(0)
puts face.inspect
handle=textureWriter.loadFace(face,true)
puts handle
result=textureWriter.writeAllTextures("C:\\tmp\\",false)
puts result
fileName=textureWriter.getTextureFile(handle)
p fileName
statistics = entityProvider.statistics

puts "#{statistics.numTypes} types available"

types = [
  SUSDK::SkpEntityProviderStatistics::StatEdge,
  SUSDK::SkpEntityProviderStatistics::StatFace,
  SUSDK::SkpEntityProviderStatistics::StatComponentInstance,
  SUSDK::SkpEntityProviderStatistics::StatConstructionLine,
  SUSDK::SkpEntityProviderStatistics::StatConstructionPoint,
  SUSDK::SkpEntityProviderStatistics::StatGroup,
  SUSDK::SkpEntityProviderStatistics::StatImage,
  SUSDK::SkpEntityProviderStatistics::StatCurve,
  SUSDK::SkpEntityProviderStatistics::StatSection,
  SUSDK::SkpEntityProviderStatistics::StatDimension,
  SUSDK::SkpEntityProviderStatistics::StatText,
  SUSDK::SkpEntityProviderStatistics::StatComponentDefinition]
  
types.each do |type|  
  puts "#{statistics.getCount(type,true)} '#{statistics.getTypeName(type)}' (which is #{type})"
end